package summary;

/**
 * @Author: 海琳琦
 * @Date: 2022/3/13 15:13
 * https://leetcode-cn.com/problems/concatenation-of-consecutive-binary-numbers/
 */
public class Title1680 {


    public static int concatenatedBinary(int n) {
        final int mod = 1000000007;
        int start = 0;
        long result = 0;
        for (int i = 1; i <= n; i++) {
            String string = Integer.toString(i, 2);
//            if ((i & (i - 1)) == 0) {
//                start++;
//            }
            result = ((result << string.length()) + i) % mod;
        }
        return (int)result;
    }

    public static void main(String[] args) {
        concatenatedBinary(12);
    }
}
